Plug leaks in error code paths
authorJohan Dahlin <johan@src.gnome.org>
Wed, 27 Jun 2007 04:03:35 +0000 (04:03 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Wed, 27 Jun 2007 04:03:35 +0000 (04:03 +0000)
* gtk/gtkbuilderparser.c: Plug leaks in error code paths

svn path=/trunk/; revision=18254

ChangeLog
gtk/gtkbuilderparser.c

index 73a2c3b84532df9c6acb7c8f5f5dbbf9fd87262d..e6ff1006576bd532574e4266baf7aa0c4cbc5fc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-06-27  Johan Dahlin  <jdahlin@async.com.br>
+
+       * gtk/gtkbuilderparser.c: Plug leaks in error code paths
+
 2007-06-26  Johan Dahlin  <jdahlin@async.com.br>
 
        * tests/buildertest.c (test_object_properties): 
index ea2df67e64bb47c32dbc7005054603762a7ab7d8..87fd6231aa92c663c5c1033f3aabb6943db6297c 100644 (file)
@@ -38,8 +38,8 @@
 #include "gtktypeutils.h"
 #include "gtkalias.h"
 
-static void free_property_info (PropertyInfo *info,
-                                gpointer      user_data);
+static void free_property_info (PropertyInfo *info);
+static void free_object_info (ObjectInfo *info);
 
 static inline void
 state_push (ParserData *data, gpointer info)
@@ -196,6 +196,8 @@ parse_object (ParserData   *data,
   if (child_info && strcmp (child_info->tag.name, "object") == 0)
     {
       error_invalid_tag (data, element_name, NULL, error);
+      if (child_info)
+       free_object_info ((ObjectInfo*)child_info);
       return;
     }
 
@@ -288,6 +290,8 @@ parse_child (ParserData   *data,
   if (!object_info || strcmp (object_info->tag.name, "object") != 0)
     {
       error_invalid_tag (data, element_name, "object", error);
+      if (object_info)
+       free_object_info (object_info);
       return;
     }
   
@@ -372,8 +376,7 @@ parse_property (ParserData   *data,
 }
 
 static void
-free_property_info (PropertyInfo *info,
-                    gpointer user_data)
+free_property_info (PropertyInfo *info)
 {
   g_free (info->data);
   g_free (info->name);
@@ -728,6 +731,9 @@ end_element (GMarkupParseContext *context,
       if (!prop_info->data)
        {
          error_missing_property_value (data, error);
+         free_property_info (prop_info);
+         if (strcmp (info->tag.name, "object") == 0)
+           free_object_info((ObjectInfo*)info);
          return;
        }